var navUl = document.getElementById('nav-ul');
var goodsUl = document.getElementById('goods-ul');
//获取分类信息
$.ajax({
  "url": 'http://lc.shudong.wang/api_cat.php',
  "type": "GET",
  "dataType": "json",
  "success": function(response){
    //处理返回的数据
    console.log(response);
    for (var i = 0; i < response.data.length; i++) {
      var obj = response.data[i];
      var oLi = document.createElement('li');
      var oA = document.createElement('a');
      oA.innerText = obj.cat_name;
      oA.href = "list.html?cat_id=" + obj.cat_id;
      oLi.appendChild(oA);
      navUl.appendChild(oLi);
    }
  },
  "error": function(message) {
    console.log(message);
  }
});
